<?php

class ContactService
{
	
	function ContactService()
	{
		mysql_connect( "localhost", "converse", "gonzaloparte" );
		mysql_select_db( "spf_converse" );	
	}
	
	private function mapContact($recordset)
	{
		require_once( "vo/ContactVO.php" );
		
		$list = array();
		
		while( $data = mysql_fetch_array($recordset))
		{
			$contactVO = new ContactVO( $data );
			array_push( $list, $contactVO );
		}
		
		return $contactVO;
	}
	
	/*******************************/
	/* FUNCIONES                   */
	/*******************************/
	
	function dameGaleria(){
		$sql ="SELECT * FROM galeria_fotos ORDER BY fecha DESC";
		$result = mysql_query($sql);
		
		$ret=array(); 
        
		while ($row = mysql_fetch_object($result)) {
        	array_push($ret,$row); 
        	
		}
		return ($ret);
	}
	
	function dameGaleriaHome($numero){
		$sql ="SELECT * FROM galeria_fotos ORDER BY fecha DESC LIMIT ".$numero;
		$result = mysql_query($sql);
		
		$ret=array(); 
        
		while ($row = mysql_fetch_object($result)) {
        	array_push($ret,$row); 
        	
		}
		return ($ret);
	}
	
	function subirFoto(){
		
	}
	
}
	
?>